/*
 * @Author: Leo.wang wanglizhigs@163.com
 * @Date: 2023-10-25 23:04:26
 * @LastEditors: Leo.wang wanglizhigs@163.com
 * @LastEditTime: 2023-10-25 23:04:39
 * @FilePath: /three-react/src/geometry/Point.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import * as THREE from 'three';

export default function createPoint() {

  // 创建一个空的几何体顶对象
  const geometry = new THREE.BufferGeometry();
  // 类型化数组定义的一组顶点坐标数据
  const vertices = new Float32Array([
    0, 0, 0, //顶点1坐标
    50, 0, 0, //顶点2坐标
    0, 100, 0, //顶点3坐标
    0, 0, 10, //顶点4坐标
    0, 0, 100, //顶点5坐标
    50, 0, 10, //顶点6坐标
  ]);
  // BufferAttribute属性缓冲对象表示顶点数据
  const attribute = new THREE.BufferAttribute(vertices, 3);
  // 设置几何体的顶点位置属性
  geometry.attributes.position = attribute;

  const material = new THREE.PointsMaterial({
    color: 0xffff00,
    size: 10
  })

  return new THREE.Points(geometry, material);
}